//
//  JCModelTableViewCell.m
//  JiFengDaRen
//
//  Created by shouhan on 2018/5/21.
//  Copyright © 2018年 陈永发. All rights reserved.
//

#import "JCModelTableViewCell.h"

@interface JCModelTableViewCell()

@property (nonatomic, strong) UIImageView * iconImage;

@property (nonatomic, strong) UILabel * titleLabel;

@property (nonatomic, strong) UILabel * contentLabel;


@end

@implementation JCModelTableViewCell

+ (instancetype)tableViewCellWithTableView:(UITableView *)tableView{
    
    static NSString * cellIndentfile = @"JCModelTableViewCell";
    JCModelTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIndentfile];
    
    if (!cell) {
        cell = [[JCModelTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIndentfile];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;

    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initUI];
    }
    return self;
}

- (void)initUI{
    
    self.iconImage = [UIImageView new];
    [self.contentView addSubview:self.iconImage];
    
    self.titleLabel = [UILabel new];
    self.titleLabel.textColor = [UIColor colorWithHexString:@"#0F8AEC"];
    self.titleLabel.font = KSHSystemFont(17);
    self.titleLabel.text = @"dddddd";
    [self.contentView addSubview:self.titleLabel];
    
    self.contentLabel = [UILabel new];
    self.contentLabel.textColor = [UIColor colorWithHexString:@"#0F8AEC"];
    self.contentLabel.font = KSHSystemFont(12);
    self.contentLabel.text = @"dqrte";
    [self.contentView addSubview:self.contentLabel];
    
    
}

- (void)layoutSubviews{
    [super layoutSubviews];
    
    [self.iconImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.contentView);
        make.top.equalTo(self.contentView).offset(__I6Height(45));
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.iconImage.mas_bottom).offset(10);
        make.centerX.equalTo(self.contentView);
    }];
    
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.titleLabel.mas_bottom).offset(10);
        make.centerX.equalTo(self.contentView);
        make.bottom.equalTo(self.contentView);
    }];
}

- (void)getDicContent:(NSMutableDictionary *)dic andIndexRow:(NSInteger)row{
    self.iconImage.image = [UIImage imageNamed:dic[@"icon"][row]];
    self.titleLabel.text = dic[@"title"][row];
    self.contentLabel.text = dic[@"content"][row];
}

@end
